//
//  NSString+Category.h
//  TestButton
//
//  Created by LQiyue on 16/4/28.
//  Copyright © 2016年 LQiyue. All rights reserved.
//

#import <Foundation/Foundation.h>

// tou像支持尺寸：50,70,150,640
// 图片支持尺寸：200, 100, 600


typedef enum {
    HeaderPic_vSmall    =0,
    HeaderPic_Middle    =1,
    HeaderPic_Small     =2,
    HeaderPic_Big       =3
} HeaderPicType;

typedef enum {
    Picture_Small    =0, // 尺寸100
    Picture_Middle   =1, // 尺寸200
    Picture_Big      =2, // 尺寸640
    Picture_Original =3, // 尺寸原图
    Picture_600      =4  // 尺寸600
} PictureType;



@interface NSString (Category)


//- (NSURL *)urlWithCodePath;
//- (NSURL *)headerURLWithUID:(NSString *)uid avatarID:(NSString *)avID sizeType:(HeaderPicType)sizeType;
//- (NSURL *)avatarUrl:(NSString *)url;
//- (NSURL *)avatarID:(NSString *)avatarID uid:(NSString *)uid;
//- (NSURL *)pictureURLWithPicID:(NSString *)pic_id sizeType:(PictureType)sizeType;

- (CGSize)getSizeWithFont:(UIFont *)font constrainedToSize:(CGSize)size;
- (CGFloat)getHeightWithFont:(UIFont *)font constrainedToSize:(CGSize)size;
- (CGFloat)getWidthWithFont:(UIFont *)font constrainedToSize:(CGSize)size;
- (CGSize)getSizeWithAttribute:(NSDictionary *)attribute constrainedToSize:(CGSize)size;

+ (NSString *)userAgentStr;

- (NSString *)URLEncoding;
- (NSString *)URLDecoding;
- (NSString *)md5Str;

//- (NSURL *)urlImageWithCodePathResize:(CGFloat)width;
//- (NSURL *)urlImageWithCodePathResize:(CGFloat)width crop:(BOOL)needCrop;
//- (NSURL *)urlImageWithCodePathResizeToView:(UIView *)view;
- (NSURL *)mohuPictureURLWithPicID:(NSString *)pic_id sizeType:(PictureType)sizeType;


//- (NSString *)stringByRemoveHtmlTag;
+ (NSString *)handelRef:(NSString *)ref path:(NSString *)path;


-(BOOL)containsEmoji;

- (NSString *)emotionMonkeyName;

+ (NSString *)sizeDisplayWithByte:(CGFloat)sizeOfByte;

- (NSString *)trimWhitespace;
- (BOOL)isEmpty;
- (BOOL)isEmptyOrListening;
//判断是否为整形
- (BOOL)isPureInt;
//判断是否为浮点形
- (BOOL)isPureFloat;

- (NSRange)rangeByTrimmingLeftCharactersInSet:(NSCharacterSet *)characterSet;
- (NSRange)rangeByTrimmingRightCharactersInSet:(NSCharacterSet *)characterSet;

- (NSString *)stringByTrimmingLeftCharactersInSet:(NSCharacterSet *)characterSet;
- (NSString *)stringByTrimmingRightCharactersInSet:(NSCharacterSet *)characterSet;

//转换拼音
- (NSString *)transformToPinyin;

//是否包含语音解析的图标
- (BOOL)hasListenChar;

+(NSDictionary *)parseJSONStringToNSDictionary:(NSString *)JSONString;
+ (NSString *)convertWithArray:(NSString *)array;
-(NSString *)handleEmptyStr;
//获取字符串size   maxW是最大宽度
- (CGSize)sizeWithFont:(UIFont *)font maxW:(CGFloat)maxW;
+ (BOOL)isEmpty:(NSString *)str;
- (NSString *)handlePointZero;
- (NSString *)pointStr;
- (NSString *)priceValue;

+ (NSString*)saveImageToLocal:(UIImage *)image;
- (NSString *)stringFromMD5;
+ (NSString *)randomWithLenth:(int)randomLength;
+ (NSString *)getIPAddress;
+ (NSString *)deviceId;

@end
